package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.ResearchPatent;
import com.ruoyi.personnel.mapper.ResearchPatentMapper;
import com.ruoyi.personnel.service.IResearchPatentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 专利管理Service业务层处理
 *
 * @author ruoyi
 * @date 2021-03-03
 */
@Service
public class ResearchPatentServiceImpl extends ServiceImpl<ResearchPatentMapper, ResearchPatent> implements IResearchPatentService {

    @Override
    public List<ResearchPatent> queryList(ResearchPatent researchPatent) {
        LambdaQueryWrapper<ResearchPatent> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(researchPatent.getInventorName())){
            lqw.like(ResearchPatent::getInventorName ,researchPatent.getInventorName());
        }
        if (StringUtils.isNotBlank(researchPatent.getInventorNumber())){
            lqw.eq(ResearchPatent::getInventorNumber ,researchPatent.getInventorNumber());
        }
        if (StringUtils.isNotBlank(researchPatent.getInventorPersonnelId())){
            lqw.eq(ResearchPatent::getInventorPersonnelId ,researchPatent.getInventorPersonnelId());
        }

        if (StringUtils.isNotBlank(researchPatent.getPatentApplicationNo())){
            lqw.eq(ResearchPatent::getPatentApplicationNo ,researchPatent.getPatentApplicationNo());
        }
        if (StringUtils.isNotBlank(researchPatent.getPatentNo())){
            lqw.eq(ResearchPatent::getPatentNo ,researchPatent.getPatentNo());
        }
        if (StringUtils.isNotBlank(researchPatent.getPatentApplicationDate())){
            lqw.eq(ResearchPatent::getPatentApplicationDate ,researchPatent.getPatentApplicationDate());
        }
        if (StringUtils.isNotBlank(researchPatent.getRightName())){
            lqw.like(ResearchPatent::getRightName ,researchPatent.getRightName());
        }
        if (StringUtils.isNotBlank(researchPatent.getRightNumber())){
            lqw.eq(ResearchPatent::getRightNumber ,researchPatent.getRightNumber());
        }
        if (StringUtils.isNotBlank(researchPatent.getRightPersonnelId())){
            lqw.eq(ResearchPatent::getRightPersonnelId ,researchPatent.getRightPersonnelId());
        }
        if (StringUtils.isNotBlank(researchPatent.getParticipantsName())){
            lqw.like(ResearchPatent::getParticipantsName ,researchPatent.getParticipantsName());
        }
        if (StringUtils.isNotBlank(researchPatent.getParticipantsNumber())){
            lqw.eq(ResearchPatent::getParticipantsNumber ,researchPatent.getParticipantsNumber());
        }
        if (StringUtils.isNotBlank(researchPatent.getParticipantsPersonnelId())){
            lqw.eq(ResearchPatent::getParticipantsPersonnelId ,researchPatent.getParticipantsPersonnelId());
        }
        if (StringUtils.isNotBlank(researchPatent.getPatentName())){
            lqw.like(ResearchPatent::getPatentName ,researchPatent.getPatentName());
        }
        if (StringUtils.isNotBlank(researchPatent.getInventorCount())){
            lqw.eq(ResearchPatent::getInventorCount ,researchPatent.getInventorCount());
        }
        if (StringUtils.isNotBlank(researchPatent.getAuthorizationDate())){
            lqw.eq(ResearchPatent::getAuthorizationDate ,researchPatent.getAuthorizationDate());
        }
        if (StringUtils.isNotBlank(researchPatent.getPatentType())){
            lqw.eq(ResearchPatent::getPatentType ,researchPatent.getPatentType());
        }
        if (StringUtils.isNotBlank(researchPatent.getPatentDescribe())){
            lqw.eq(ResearchPatent::getPatentDescribe ,researchPatent.getPatentDescribe());
        }
        if (StringUtils.isNotBlank(researchPatent.getEnclosure())){
            lqw.eq(ResearchPatent::getEnclosure ,researchPatent.getEnclosure());
        }
        if (StringUtils.isNotBlank(researchPatent.getEnclosureName())){
            lqw.like(ResearchPatent::getEnclosureName ,researchPatent.getEnclosureName());
        }
        if (StringUtils.isNotBlank(researchPatent.getStatus())){
            lqw.eq(ResearchPatent::getStatus ,researchPatent.getStatus());
        }
        return this.list(lqw);
    }
}
